/**
 * @file server.h
 * @brief Server class definition
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * @author VestniK (Sergey N.Vidyuk) sir.vestnik@gmail.com
 * @date 17 Oct 2008
 */
#ifndef _Server_H_
#define _Server_H_

#include <QtCore/QtCore>
#include <QtNetwork/QtNetwork>

#include "game.h"

namespace mjn {
    class SessionFactory;

   /**
    * @brief Compleate server
    *
    * This class listens for incomming connections. When connction is
    * established it waits for connection request and gives ProtocolSession
    * instance to Game.
    */
   class Server:public QObject {
      Q_OBJECT
      public:
         Server(quint16 port = 0);
         ~Server();
      protected slots:
         /// Process incomming TCP connections
         void onTcpConnection();
      private:
         Game mGame;
         QTcpServer mTcpServer;
         SessionFactory *mSessionFactory;
   };

} // namespace mjn

#endif
